<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 下面是一个更复杂的例子。
        let total = 30;
        let msg = passthru `The total is ${total} (${total*1.05} with tax)`;

        function passthru(literals) {
            let result = '';
            let i = 0;

            while (i < literals.length) {
                result += literals[i++];
                if (i < arguments.length) {
                    result += arguments[i];
                }
            }

            return result;
        }

        msg // "The total is 30 (31.5 with tax)"

        // 上面这个例子展示了，如何将各个参数按照原来的位置拼合回去。
    </script>
</body>

</html>